//
//  LSZBDetailsPlayTableViewCell.m
//  JKFuYinProject
//
//  Created by 九酷 on 2018/4/26.
//  Copyright © 2018年 LC. All rights reserved.
//

#import "LSZBDetailsPlayTableViewCell.h"

@implementation LSZBDetailsPlayTableViewCell

-(id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.labelNumber = [[UILabel alloc]init];
        self.labelNumber.textColor = lightColor;
        [LSZSpecialPackaging setLabelAdaptiveSize:self.labelNumber font:17];
        self.labelNumber.textAlignment = NSTextAlignmentCenter;
        [self addSubview:self.labelNumber];

        self.labelTitle = [[UILabel alloc]init];
        self.labelTitle.textColor = titleColorLSZ;
        [LSZSpecialPackaging setLabel_14_5_Size:self.labelTitle];
        [self addSubview:self.labelTitle];

        self.imageViewPlay = [[UIImageView alloc]init];
        self.imageViewPlay.image = [UIImage imageNamed:@"播放三角"];
        [self addSubview:self.imageViewPlay];

        self.labelPlayNumber = [[UILabel alloc]init];
        self.labelPlayNumber.textColor = [UIColor colorWithRed:200/255.0 green:200/255.0 blue:200/255.0 alpha:1];
        [self addSubview:self.labelPlayNumber];

        self.butDownload = [[UIButton alloc]init];
        [self addSubview:self.butDownload];

        self.imageDownload = [[UIImageView alloc]init];
        self.imageDownload.image = [UIImage imageNamed:@"视频_下载"];
        self.imageDownload.userInteractionEnabled = YES;
        [self.butDownload addSubview:self.imageDownload];
        if (ScreenWidth == 320) {
            //5
            self.labelNumber.frame = CGRectMake(0,0,50, 50);
            self.labelTitle.frame = CGRectMake(CGRectGetMaxX(self.labelNumber.frame),5, ScreenWidth - CGRectGetMaxX(self.labelNumber.frame)-40, 20);
            self.imageViewPlay.frame = CGRectMake(CGRectGetMaxX(self.labelNumber.frame)+2,CGRectGetMaxY(self.labelTitle.frame),20, 20);
            self.labelPlayNumber.frame = CGRectMake(CGRectGetMaxX(self.imageViewPlay.frame)+5,CGRectGetMaxY(self.labelTitle.frame) ,ScreenWidth-CGRectGetMaxX(self.imageViewPlay.frame)-60, 20);
            self.butDownload.frame = CGRectMake(ScreenWidth-50, 0,50, 50);
            self.imageDownload.frame = CGRectMake((self.butDownload.frame.size.width-30)/2, 12.5, 30, 25);
        }else if(ScreenWidth == 375){
            // 6 7
            self.labelNumber.frame = CGRectMake(0,0,50, 55);
            self.labelTitle.frame = CGRectMake(CGRectGetMaxX(self.labelNumber.frame),7.5, ScreenWidth - CGRectGetMaxX(self.labelNumber.frame)-40, 20);
            self.imageViewPlay.frame = CGRectMake(CGRectGetMaxX(self.labelNumber.frame), CGRectGetMaxY(self.labelTitle.frame),20, 20);
            self.labelPlayNumber.frame = CGRectMake(CGRectGetMaxX(self.imageViewPlay.frame)+5,CGRectGetMaxY(self.labelTitle.frame) ,ScreenWidth-CGRectGetMaxX(self.imageViewPlay.frame)-60, 20);
            self.butDownload.frame = CGRectMake(ScreenWidth-50, 0,50, 55);
            self.imageDownload.frame = CGRectMake((self.butDownload.frame.size.width-30)/2, 15, 30, 25);
        }else {
            //plus
            self.labelNumber.frame = CGRectMake(0,0,50, 60);
            self.labelTitle.frame = CGRectMake(CGRectGetMaxX(self.labelNumber.frame),8, ScreenWidth - CGRectGetMaxX(self.labelNumber.frame)-40, 22);
            self.imageViewPlay.frame = CGRectMake(CGRectGetMaxX(self.labelNumber.frame)+2, CGRectGetMaxY(self.labelTitle.frame),22, 22);
            self.labelPlayNumber.frame = CGRectMake(CGRectGetMaxX(self.imageViewPlay.frame)+5,CGRectGetMaxY(self.labelTitle.frame),ScreenWidth-CGRectGetMaxX(self.imageViewPlay.frame)-60, 22);
            self.butDownload.frame = CGRectMake(ScreenWidth-50, 0,50, 60);
            self.imageDownload.frame = CGRectMake((self.butDownload.frame.size.width-30)/2, 17.5, 30, 25);
        }
    }
    return self;
}
-(void)setIsOrPlayer:(BOOL)isOrPlayer
{
    if (isOrPlayer == YES) {
        self.labelNumber.textColor = redUIColor;
        self.labelTitle.textColor = redUIColor;
        self.labelPlayNumber.textColor = redUIColor;
        self.imageViewPlay.image = [UIImage imageNamed:@"播放三角_红色"];
    }else{
        self.labelNumber.textColor = lightColor;
        self.labelTitle.textColor = titleColorLSZ;
        self.labelPlayNumber.textColor = [UIColor colorWithRed:200/255.0 green:200/255.0 blue:200/255.0 alpha:1];
        self.imageViewPlay.image = [UIImage imageNamed:@"播放三角"];
    }
}
@end
